﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataConcept.Entities;

namespace DataConcept.Business
{
    public class bl_Scene
    {
        da_ConceptEntities db = new da_ConceptEntities();

        public Guid Create(string value, string key, Guid parentId, byte status)
        {
            var sceneId = Guid.NewGuid();
            var result = (int)db.da_Scene_New(
                sceneId,
                value,
                key,
                parentId,
                status).Single();

            if (result > 0)
                return sceneId;
            else
                return Guid.Empty;
        }
        public int Update(Guid sceneId, string value, string key, Guid parentId, byte status)
        {
            var result = (int)db.da_Scene_Update(
                sceneId,
                value,
                key,
                parentId,
                status).Single();

            return result;
        }
        public int Delete(Guid sceneId)
        {
            var result = (int)db.da_Scene_Delete(
                sceneId).Single();

            return result;
        }

        public da_Scene GetById(Guid sceneId)
        {
            var result = db.da_Scene_GetbyId(
                sceneId).ToList();

            if (result.Count > 0)
                return result.First();
            else
                return null;
        }
        public List<da_Scene> GetAll()
        {
            var result = db.da_Scene.ToList();

            return result;
        }
    }
}
